/******************************************************************************
*	cmQueue.h	Header file of CM Queue Module
*
*	coypright (C) 2009 Ding Lixing
*
******************************************************************************/


#ifndef __CMQUEUE_INC__
#define __CMQUEUE_INC__

#ifdef __cplusplus
extern "C" {
#endif

struct cmQueueData_typ {
    unsigned int msgNumMax;
    unsigned long *msgBuf;
    unsigned int wp;
    unsigned int rp;
};
typedef struct cmQueueData_typ cmQUEUEDATA;

struct cmQueue_typ {
    cmOBJ recvObj;
    cmOBJ sendObj;
    cmQUEUEDATA data;
};
typedef struct cmQueue_typ cmQUEUE;

extern int cmQueueInit(cmQUEUE *queue, unsigned int opt, unsigned int msgNum, unsigned long *msgBuf);
extern int cmQueueSend(cmQUEUE *queue, unsigned long msg, unsigned int tout);
extern int cmQueueRecv(cmQUEUE *queue, unsigned long *msg, unsigned int tout);
extern int cmQueueFlush(cmQUEUE *queue);

#ifdef __cplusplus
}
#endif

#endif /* __CMQUEUE_INC__ */

